// 定义变量  let 变量名:数据类型 = 值
let username:string = 'lili';

username='zs';

let num:number = 1;

num = 1.0;

num = 0.122;

let num1:number = 1;

let isLogin:boolean = true;

let value:null = null;

let test:undefined = undefined;

//推断数据的类型

// let param = 1;

// param = 'world';

//联合类型

let param:string|number = 1;
param = '123';

//any

// let param1:any = '123';
// param1 = undefined;

//数组的定义

let arr1:string[] = ['a','b','c'];

let arr2:Array<number> = [1,2,3];

//元组

let t1:[string,number,boolean] = ['sds',1,true];

console.log(t1[2]);

//枚举  常量

enum Sex{
    girl=1,
    boy=2,
    unkown=3
}

enum Color{
    write ='#fff',
    black = '#000'
}

enum Week{
    Monday,
    Tuesday,
    Wednesday,
    Thursday,
    Friday,
    Saturday,
    Sunday
}

console.log("----",Week)

// console.log(Sex.girl);

// console.log(Color.black);
function getInfo(name:string):string;
function getInfo(age:number):string;
function getInfo(param:any):any{
    if(typeof param === 'string'){
        return `我叫：${param}`
    }else if(typeof param == 'number'){
        return `我${param}岁`
    }else{
        return '输入错误'
    }
}

console.log(getInfo('lili'))

console.log(getInfo(18))








